@extends('layouts.admin_common') @section('content')

    @if(app('env')=='production')
        <script src="{{ secure_asset('/js/sy_common.js') }}"></script>
    @else
        <script src="{{ asset('/js/sy_common.js') }}"></script>
    @endif

    <div class="breadcrumbs_container">{{
	Breadcrumbs::render('admin.sail_list') }}</div>
    <div class="system_tab_line"></div>

    <div class="lyx_search_table">
        <form>

            <div class="row">

                <div class="form-group row col-sm-4">
                    <label for="inputPassword" class="col-sm-4 col-form-label">売上日</label>
                    <div class="col-sm-8">
                        <input class="form-control lyx_datetimepicker" type="text" @isset($param['star_date']) value="{{$param['star_date']}}"  @endisset name="star_date">
                    </div>
                </div>

                <div class="form-group row col-sm-4">
                    <label for="inputPassword" class="col-sm-1 col-form-label">~</label>
                    <div class="col-sm-8">
                        <input class="form-control lyx_datetimepicker" type="text" @isset($param['end_date']) value="{{$param['end_date']}}" @endisset name="end_date">
                    </div>
                </div>

                <div class="form-check form-check-inline col-sm-4">
                    <label for="inputPassword" class="col-sm-4 col-form-label">未入金含む</label>
                    <div class="col-sm-2">
                        <input class="form-check-input" type="checkbox" value="1" {{is_selected(1, $param, 'no_money',2)}} name="no_money">
                    </div>
                </div>

            </div>

            <div class="row">

                <div class="form-group row col-sm-4">
                    <label for="inputPassword" class="col-sm-4 col-form-label">会社名</label>
                    <div class="col-sm-8">
                        <select class="form-control" name="corp_id" id="lyx_companys">
                            <option value="" >@lang('symessages.info.all_msg')</option>
                            @foreach($companys as $com)
                                <option value="{{$com->corp_id}}" {{is_selected($com->corp_id, $param, 'corp_id')}}>{{$com->corp_name}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>

                <div class="form-group row col-sm-4">
                    <label for="inputPassword" class="col-sm-4 col-form-label">店舗名</label>
                    <div class="col-sm-8">
                        <select class="form-control" name="shop_id" id="lyx_companys">
                            <option value="" >@lang('symessages.info.all_msg')</option>
                            @foreach($shops as $com)
                                <option value="{{$com->shop_id}}" {{is_selected($com->shop_id, $param, 'shop_id')}}>{{$com->shop_name}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>




            <div class="row">
                <div class="col-sm-6"></div>
                <div class="col-sm-3">
                    <button class="btn btn-primary button_normal">検索</button>
                </div>
                <div class="col-sm-3">
                    <a href="{{url('admin/exp_sail_list')}}" class="btn btn-primary button_normal">csv出力</a>
                </div>
            </div>

        </form>


        <div class="lyx_table">
            <div class="row lyx_table_title">
                <div class="col-sm-1"></div>
                <div class="col-sm-7">売上一覧</div>
                <div class="col-sm-4">出力日:2018 / 8/31</div>
            </div>
            <div class="row">
                <div class="col-sm-1"></div>
                <div class="col-sm-6">
                    期間:2018 / 4/1 〜 2018/8/31
                </div>
            </div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th scope="col">@lang('symessages.info.sell_date')</th>
                    <th scope="col">@lang('symessages.info.company_name')</th>
                    <th scope="col">@lang('symessages.info.company_shop')</th>
                    <th scope="col">@lang('symessages.info.category')</th>
                    <th scope="col">@lang('symessages.info.product_name')</th>
                    <th scope="col">@lang('symessages.info.color')</th>
                    <th scope="col">@lang('symessages.info.size')</th>
                    <th scope="col">@lang('symessages.info.order_goods_num')</th>
                    <th scope="col">@lang('symessages.info.out_num')</th>
                    <th scope="col">@lang('symessages.info.total_money')</th>
                </tr>
                </thead>
                <tbody>
                @foreach($list as $value)
                    <?php $total_money=0; $corp_name = '';?>
                    @foreach($value as $two)
                        <tr>
                            <td>{{toDate(strtotime($two->create_time),'Y-m-d')}}</td>
                            <td>{{fun_corp($two->corp_id)}}</td>
                            <td>{{fun_shop($two->shop_id)}}</td>
                            <td>{{fun_category($two->category_id)}}</td>
                            <td>{{$two->goods_name}}</td>
                            <td>{{fun_colors($two->color)}}</td>
                            <td>{{fun_size($two->size)}}</td>
                            <td>{{$two->goods_num}}</td>
                            <td>{{$two->num}}</td>
                            <td>¥{{$two->num * $two->goods_price}}</td>
                        </tr>
                        <?php $total_money = $total_money+($two->num * $two->goods_price); $corp_name = fun_corp($two->corp_id);?>
                @endforeach
                <tr>
                    <td colspan="9">{{$corp_name}} 合計</td>
                    <td>¥<?php echo $total_money; ?></td>
                </tr>
                <tr style="height: 10px">

                </tr>

                @endforeach

                </tbody>
            </table>
        </div>

    </div>


@endsection

